// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Requests;
using Elastic.Clients.Elasticsearch.Serialization;
using Elastic.Transport;
using Elastic.Transport.Extensions;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch;

public sealed partial class ClearScrollRequestParameters : RequestParameters
{
}

/// <summary>
/// <para>
/// Clears the search context and results for a scrolling search.
/// </para>
/// </summary>
public sealed partial class ClearScrollRequest : PlainRequest<ClearScrollRequestParameters>
{
	internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceClearScroll;

	protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE;

	internal override bool SupportsBody => true;

	internal override string OperationName => "clear_scroll";

	/// <summary>
	/// <para>
	/// Scroll IDs to clear.
	/// To clear all scroll IDs, use <c>_all</c>.
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("scroll_id")]
	public Elastic.Clients.Elasticsearch.ScrollIds? ScrollId { get; set; }
}

/// <summary>
/// <para>
/// Clears the search context and results for a scrolling search.
/// </para>
/// </summary>
public sealed partial class ClearScrollRequestDescriptor : RequestDescriptor<ClearScrollRequestDescriptor, ClearScrollRequestParameters>
{
	internal ClearScrollRequestDescriptor(Action<ClearScrollRequestDescriptor> configure) => configure.Invoke(this);

	public ClearScrollRequestDescriptor()
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.NoNamespaceClearScroll;

	protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE;

	internal override bool SupportsBody => true;

	internal override string OperationName => "clear_scroll";

	private Elastic.Clients.Elasticsearch.ScrollIds? ScrollIdValue { get; set; }

	/// <summary>
	/// <para>
	/// Scroll IDs to clear.
	/// To clear all scroll IDs, use <c>_all</c>.
	/// </para>
	/// </summary>
	public ClearScrollRequestDescriptor ScrollId(Elastic.Clients.Elasticsearch.ScrollIds? scrollId)
	{
		ScrollIdValue = scrollId;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		if (ScrollIdValue is not null)
		{
			writer.WritePropertyName("scroll_id");
			JsonSerializer.Serialize(writer, ScrollIdValue, options);
		}

		writer.WriteEndObject();
	}
}